<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    ul {
      display: flex;
      list-style: none;

    }

    li {
      margin: 10px
    }

    .active {
      background-color: red;
    }
  </style>
</head>

<body>
  <div id="app">
    =={{msg}}==={{index}}
    <hr />
    <h1 :class="a">h1</h1>
    <ul>
      <!-- <li :class="index==0?'active':''" @click="picHandle(0)">这是第1张图</li>
      <li :class="index==1?'active':''" @click="picHandle(1)">这是第2张图</li>
      <li :class="index==2?'active':''" @click="picHandle(2)">这是第3张图</li>
      <li :class="index==3?'active':''" @click="picHandle(3)">这是第4张图</li>
      <li :class="index==4?'active':''" @click="picHandle(4)">这是第5张图</li>
      <li :class="index==5?'active':''" @click="picHandle(5)">这是第6张图</li>
      <li :class="index==6?'active':''" @click="picHandle(6)">这是第7张图</li>
      <li :class="index==7?'active':''" @click="picHandle(7)">这是第8张图</li> -->
      <li :class="index==0?a:''" @click="picHandle(0)">这是第1张图</li>
      <li :class="index==1?a:''" @click="picHandle(1)">这是第2张图</li>
      <li :class="index==2?a:''" @click="picHandle(2)">这是第3张图</li>
      <li :class="index==3?a:''" @click="picHandle(3)">这是第4张图</li>
      <li :class="index==4?a:''" @click="picHandle(4)">这是第5张图</li>
      <li :class="index==5?a:''" @click="picHandle(5)">这是第6张图</li>
      <li :class="index==6?a:''" @click="picHandle(6)">这是第7张图</li>
      <li :class="index==7?a:''" @click="picHandle(7)">这是第8张图</li>
    </ul>
    <!-- <img :src="url" alt=""> -->
    <img :src="srcArr[index]" alt="">
  </div>
  <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.14/vue.min.js"></script>
  <script>
    var vm = new Vue({
      el: "#app",
      data: {
        msg: 'hello  vue',
        srcArr: [
          './assets/10-01.png',
          './assets/10-02.png',
          './assets/11-00.gif',
          './assets/11-01.gif',
          './assets/11-02.gif',
          './assets/11-03.gif',
          './assets/11-04.png',
          './assets/11-05.png',
        ],
        index: 0,
        url: './assets/10-01.png',
        a: 'active'
      },
      methods: {
        picHandle (i) {
          // console.log(this, i);
          this.index = i
          // this.url = this.srcArr[i]
        }
      }
    })

    // console.log(vm, 2222);
  </script>
</body>

</html>